package cn.findviewbydream.evil.main.enums;

/********************************************
 * 工程名：HebeuCS
 * 包名：cn.findviewbydream.evil.main.enums
 * 时间：16-11-1 下午5:30
 * 作者：白雨濃 evil
 * 邮箱：evilbai@foxmail.com
 * 内容：注册返回类型
 ********************************************/
public enum RegisterType
{
    SUCCESS(1, "注册成功"),
    FAIL_REPEAT(-1, "该账户已经被注册"),
    FAIL_TOLONG(-2, "账户名或密码过长"),
    ERROR(-3, "发生错误");

    private int index;
    private String state;


    RegisterType(int index, String state)
    {
        this.index = index;
        this.state = state;
    }

    public static String getState(int index)
    {
        for (RegisterType typeEnum : RegisterType.values())
            if (typeEnum.getIndex() == index)
                return typeEnum.state;
        return null;
    }

    public int getIndex()
    {
        return index;
    }

    public String getState()
    {
        return state;
    }

}
